Repository navigation
Conversation
isaacs
added this pull request to stack #25346
October 14, 2026 03:19
Member
Author
|
Bugbot run |
isaacs
marked this pull request as ready for review
October 14, 2026 04:02
isaacs
force-pushed
the
isaacschlueter/js-3934-sentryastro-use-the-cloudflare-vite-plugin-for-workers
branch
from
October 14, 2026 04:03
f2b7725 to
9ee9847
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 9ee9847. Configure here.
isaacs
force-pushed
the
isaacschlueter/js-3934-sentryastro-use-the-cloudflare-vite-plugin-for-workers
branch
5 times, most recently
from
October 14, 2026 23:36
5edda85 to
9e3de29
Compare
JPeer264
force-pushed
the
isaacschlueter/js-3934-sentryastro-use-the-cloudflare-vite-plugin-for-workers
branch
from
October 15, 2026 08:45
9e3de29 to
966e0af
Compare
isaacs
force-pushed
the
isaacschlueter/js-3934-sentryastro-use-the-cloudflare-vite-plugin-for-workers
branch
from
October 15, 2026 14:06
966e0af to
5715055
Compare
Base automatically changed from
isaacs/auto-instrument-default-export-re-exported
to
develop
October 15, 2026 14:27
isaacs
force-pushed
the
isaacschlueter/js-3934-sentryastro-use-the-cloudflare-vite-plugin-for-workers
branch
from
October 15, 2026 14:27
5715055 to
8eb70d7
Compare
On Cloudflare Workers, an Astro app needed a hand-written
`sentry.server.config.*` that wraps the adapter's handler, set as the
wrangler `main`. The integration's own Cloudflare plugin wraps
`astrojs-ssr-virtual-entry`, which `@astrojs/cloudflare` v13 and later
no longer emit, so on those versions it wraps nothing.
`@sentry/cloudflare/vite` can now wrap a package `main`, such as
`@astrojs/cloudflare/entrypoints/server`. When the user adds
`sentryCloudflareVitePlugin()` to the Vite plugins in `astro.config`,
the integration now leaves the Worker to it:
- It does not add its own Cloudflare wrap plugin.
- It does not add its orchestrion plugin, because the Cloudflare plugin
adds one with the workerd-safe `diagnostics_channel` module.
- It does not inject the default server init. That init reads
`PUBLIC_SENTRY_DSN`, which is not set on Workers, so it disabled the
transport. The Cloudflare plugin inits the SDK from
`instrument.server.*` beside the wrangler config, or from `env`.
The integration detects the plugin by name. Importing it would load
`@sentry/cloudflare` and `wrangler` for every Astro app.
Apps without the plugin keep the integration's own wrap plugin. It now
also matches `virtual:cloudflare/worker-entry`, the entry module of
`@cloudflare/vite-plugin`, which v13 and later build through. That
entry ends in `export default mod.default ?? {};`, so the plugin now
wraps any default export expression, not only a dotted name. When the
user's `main` already wraps the handler, the second `withSentry` call
does nothing new, because each handler method is patched only once.
The `astro-6-cf-workers` e2e app now uses the new setup: `main` is the
adapter's entry, and the options live in `instrument.server.js`.
Fixes JS-3934
Fixes JS-2893
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This PR adds an e2e test that makes the prior one unnecessary. Remove it.
isaacs
force-pushed
the
isaacschlueter/js-3934-sentryastro-use-the-cloudflare-vite-plugin-for-workers
branch
from
October 15, 2026 16:43
8eb70d7 to
55fd5d1
Compare
isaacs
deleted the
isaacschlueter/js-3934-sentryastro-use-the-cloudflare-vite-plugin-for-workers
branch
October 15, 2026 19:03
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

On Cloudflare Workers, an Astro app needed a hand-written
sentry.server.config.*that wraps the adapter's handler, set as the wranglermain. The integration's own Cloudflare plugin wrapsastrojs-ssr-virtual-entry, which@astrojs/cloudflarev13 and later no longer emit, so on those versions it wraps nothing.@sentry/cloudflare/vitecan now wrap a packagemain, such as@astrojs/cloudflare/entrypoints/server. When the user addssentryCloudflareVitePlugin()to the Vite plugins inastro.config, the integration now leaves the Worker to it:diagnostics_channelmodule.PUBLIC_SENTRY_DSN, which is not set on Workers, so it disabled the transport. The Cloudflare plugin inits the SDK frominstrument.server.*beside the wrangler config, or fromenv.The integration detects the plugin by name. Importing it would load
@sentry/cloudflareandwranglerfor every Astro app.Apps without the plugin keep the integration's own wrap plugin. It now also matches
virtual:cloudflare/worker-entry, the entry module of@cloudflare/vite-plugin, which v13 and later build through. That entry ends inexport default mod.default ?? {};, so the plugin now wraps any default export expression, not only a dotted name. When the user'smainalready wraps the handler, the secondwithSentrycall does nothing new, because each handler method is patched only once.The
astro-6-cf-workerse2e app now uses the new setup:mainis the adapter's entry, and the options live ininstrument.server.js. This replaces thecloudflare-autoinstrument-package-entrye2e app, as its coverage largely overlaps with it.Fixes JS-3934
Fixes JS-2893
Fixes #21901
Fixes #25344